package com.level.system.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.level.system.base.PageBean;
import com.level.system.base.ResponseBean;
import com.level.system.entity.QcRule;
import com.level.system.entity.VO.QcContrastRuleVO;
import com.level.system.service.QcRuleService;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 质控规则表 前端控制器
 * </p>
 *
 * @author zhaocw
 * @since 2019-05-08
 */
@RestController
@RequestMapping("/qcRule")
@SuppressWarnings("all")
public class QcRuleController {

	@Autowired
	private QcRuleService qcRuleServicec;
	
	
	@RequestMapping(value="/getQcRuleByPage",method= RequestMethod.POST)
	@ApiOperation(value="根据ID查找 QcRule 表用户", notes="备注: 仅200有正确返回")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "status", value = "数据状态", required = true, dataType = "String"),
		@ApiImplicitParam(name = "current", value = "当前页", required = true, dataType = "Integer"),
		@ApiImplicitParam(name = "size", value = "每页条数", required = true, dataType = "Integer")
	})
	public ResponseBean<IPage<QcRule>> getQcRuleByPage(PageBean page,String status){
		return ResponseBean.success("成功",qcRuleServicec.selectPageVo(page,status));
	}
	
	@RequestMapping(value="/insertQCRule",method= RequestMethod.POST)
	@ApiOperation(value="新增 QcRule 表用户", notes="备注: 仅200有正确返回")
	public <T> ResponseBean<T> insertQCRule(QcRule qcRule,String opt){
		qcRuleServicec.insertQCRule(qcRule,opt);
		return ResponseBean.success("成功");
	}
	
	@RequestMapping(value="/updateQCRule",method= RequestMethod.POST)
	@ApiOperation(value="根据ID更新 QcRule 表用户", notes="备注: 仅200有正确返回")
	public <T> ResponseBean<T> updateQCRule(QcRule qcRule){
		qcRuleServicec.updateById(qcRule);
		return ResponseBean.success("更新成功");
	}
	
	/**
	 * 更新质控标志   注销
	 * @param qcRule
	 * @return
	 */
	@RequestMapping(value="/deleteQCRule",method= RequestMethod.POST)
	@ApiOperation(value="根据ID更新 QcRule 表用户", notes="备注: 仅200有正确返回")
	public <T> ResponseBean<T> deleteQCRule(QcRule qcRule){
		qcRuleServicec.updateById(qcRule);
		return ResponseBean.success("删除成功");
	}
	
	/**
	 * 获取单个质控记录
	 * @param id
	 * @return
	 */
	@RequestMapping(value="/getQCRuleById",method= RequestMethod.POST)
	@ApiOperation(value="根据ID更新 QcRule 表用户", notes="备注: 仅200有正确返回")
	public <T> ResponseBean<QcRule> getQCRuleById(String id){
		return ResponseBean.success("成功",qcRuleServicec.getById(id));
	}
	
	
	
	@RequestMapping(value="/contrastRule",method= RequestMethod.POST)
	@ApiOperation(value="根据ID更新 QcRule 表用户", notes="备注: 仅200有正确返回")
	public <T> ResponseBean<T> contrastRule(QcContrastRuleVO VO){
		qcRuleServicec.contrastRule(VO);
		return ResponseBean.success("成功");
	}
}

